package com.imooc.ad;


import com.alibaba.fastjson.JSON;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class MapUsePut {
    private static Map<String, Long> objectMap = new ConcurrentHashMap<>();

    public static void main(String[] args) {
        // 打印出堆栈信息并没有重新抛出
//        try {
//            throw new NullPointerException();
//        } catch (NullPointerException ex) {
//            ex.printStackTrace();
//        }
        objectMap.put("2", new Long(2));
        objectMap.get(null);

//        System.out.println(objectMap.get(null));//空指针异常
    }
}



















//        objectMap.put("2", new Dog(2, "peter"));
//        Dog hello = objectMap.get("2");
//        hello.setName("peters");
//        System.out.println(JSON.toJSONString(objectMap));